package com.gxa.controller;

import com.gxa.common.base.PageWrapperDTO;
import com.gxa.common.base.RespResult;
import com.gxa.domain.dto.SysUserReqListDTO;
import com.gxa.domain.dto.SysUserSaveDTO;
import com.gxa.domain.dto.SysUserUpdateDTO;
import com.gxa.domain.vo.SysUserVO;
import com.gxa.service.SysUserService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "系统管理-用户管理")
@RestController
@RequestMapping("/system/sys_user")
@Slf4j
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    /**
     * 获取用户列表
     */
    @ApiOperation(value = "获取用户列表-分页", notes = "获取用户列表-分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNo",value = "当前页码数",defaultValue = "1",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",defaultValue = "10",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "roleId",value = "角色ID",required = false,paramType = "query",dataType = "String")
    })
    @GetMapping("/list")
    public RespResult<PageWrapperDTO<SysUserVO>> list(SysUserReqListDTO sysUserReqListDTO){
        return sysUserService.list(sysUserReqListDTO);
    }




    /**
     * 新增用户
     */
    @ApiOperation(value = "新增保存", notes = "新增保存")
    @PostMapping("/save")
    public RespResult save(@RequestBody @ApiParam(name = "data",value = "系统用户添加实体") @Validated SysUserSaveDTO sysUserSaveDTO) {
        // 保存
        return RespResult.success();
    }

    /**
     * 修改用户
     */
    @ApiOperation(value = "修改保存", notes = "修改保存")
    @PostMapping("/update")
    public RespResult update(@RequestBody @ApiParam(name = "data",value = "系统用户修改实体") SysUserUpdateDTO sysUserUpdateDTO) {
        return RespResult.success();
    }


    /**
     * 删除用户
     */
    @ApiOperation(value = "删除用户", notes = "删除用户")
    @ApiImplicitParam(name = "user_id",value = "用户id",required = true,dataType = "String",paramType = "path")
    @PostMapping("/delete/{user_id}")
    public RespResult delete(@PathVariable("user_id") Long userId){
        return RespResult.success();
    }




}
